package com.linewell.license.demo.designPattern.createPattern.FactotyPattern;

import com.linewell.license.demo.designPattern.createPattern.FactotyPattern.car.Car;
import com.linewell.license.demo.designPattern.createPattern.FactotyPattern.car.CarFactory;

/**
 * @Title: springBootDemo
 * @description: 抽象工厂模式
 * 将工厂进行二次工厂
 * @author: hyuhuang@linewell.com
 * @since:2019/11/22
 */
public class FactoryPattern {

    public static void main(String[] args) {
        //获取自行车工厂
        AbstractFactory cycle = FactoryProducer.getFactory("cycle");
        //获取car工厂
        AbstractFactory car = FactoryProducer.getFactory("car");
        //从自行车工厂生产摩托自行车
        cycle.getCycle("moto").run();
        //从自行车工厂生产电动自行车
        cycle.getCycle("elec").run();
        //从汽车工厂获取宝马
        car.getCar("BMW").run();
        //从汽车工厂获取梅赛德斯
        car.getCar("Mercedes").run();
    }
}







